<%@ page language="Java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Home</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta name="_csrf" content="${_csrf.token}" />
<!-- default header name is X-CSRF-TOKEN -->
<meta name="_csrf_header" content="${_csrf.headerName}" />
</head>
<body>
  <div style="width: 100%; height: 60px; position: fixed; background-color: #efefef">
    <button
      style="float: right; display: block; width: 60px; height: 40px; marign-right: 16px; font-size: 13px; color: #efefef; background-color: #33cccc"
      id="logoutBtn">Log out</button>
  </div>
</body>
<script src="/public/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
	$(function() {
		var token = $("meta[name='_csrf']").attr("content");
		var header = $("meta[name='_csrf_header']").attr("content");
		$(document).ajaxSend(function(e, xhr, options) {
			xhr.setRequestHeader(header, token);
		});
	});

	$("#logoutBtn").click(function() {
		$.post({
			url:"/logout"
		});
	});
</script>
</html>